Fixes Sidebar and Event/Venue Panels opening by default #935
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
This PR updates the scrips that register the PluginDocumentSettingPanel slotfills for Events and Venues and ensures the General Sidebar, the Events Settings Panel, and the Venue Settings Panel all open by default.
The
initialOpen
property was added to both event and venue slotfills, however the PluginDocumentSettingPanel slotfill does not accept the property. It uses a useSelect to detect weather the panel is opened and passes that to the<Panel>
. The opened property overrides the initialOpen which could be why that property isn't allowed.The dependency for the PluginDocumentSettingPanel was moved to '@wordpress/editor' and there were deprecation warnings showing in the browser console. I updated the dependency.
In the event-settings and venue-settings panel registration there was a dispatch to toggle the settings panel open. One issue with toggling is when the panel is already open, it would be closed. To fix this I first check if the panel is open before toggling. I wrapped these in a domReady() to make sure the DOM was fully loaded, then use the 'core/edit-post' select to see if the panel is open.
The toggling of the panels was also moved, so I updated the use of the
toggleEditorPanelOpened()
functions to use the 'core/editor' dispatch. instead of 'core/edit-post'.In the
editor.js
file there was a domReady that was making sure the main sidebar was open, but it also was duplicating the work of opening the event sidebar. I removed the duplicate functionality and just use this script to make sure the general sidebar is open.Closes #891
How to test the Change
This also works for the Venue Settings Panel
Changelog Entry
Credits
Props @ajskelton
Checklist: